﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" import="java.sql.*"%>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="java.net.URLDecoder" %>
<%@ page import="ookweb.*"%>
<%@ include file="head.jsp" %> 
<% String menu="2"; 
String  tmp="";
%>
<% //request.setCharacterEncoding("utf-8");
%>
<div class="area">
 <%@ include file="top21.jsp" %> 
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
   <tr>
     <td width="13"></td>
     <td width="746" height="640" align="center" valign="top">
     <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="45%" height="55" align="center" valign="top"><a href="index.jsp"><img src="images/homelogo.gif" width="297" height="46" border=0 /></a></td>
    <td width="55%" valign="bottom"><img src="images/hometopbt.gif" width="204" height="20" style=" margin-bottom:12px;" /></td>
  </tr>
</table>

     <%@ include file="menu.jsp" %> 
     <%
      Data data=new Data(dbuser,dbpass,dburl);
   //分页段   //变量声明 
//String key=request.getParameter("sokey");
String key = new String(request.getParameter("sokey").getBytes("ISO-8859-1"),"UTF-8");

String mysql=new String(); //SQL语句
String where="";
mysql=" web_info where iid>0";

if(!("".equals(key) || key==null)){

where=where+" and (title like '%"+key+"%' or keyword like '%"+key+"%')";
}

int intRowCount=0;  //总的记录数
int intPageCount=0; //总的页数
int intPageSize=6; //每页显示的记录数
int intPage; //待显示页码 
String strPage=new String(); //用来接收当页码参数
int begin_no=0; //开始的rownum记录号
int end_no=0;  //结束的rownum记录号

//取得待显示页码 
strPage = request.getParameter("pages"); 
if(strPage==null || "".equals(strPage)){//表明在QueryString中没有page这一个参数，此时显示第一页数据 
intPage = 1; 
} 
else{//将字符串转换成整型 
intPage = java.lang.Integer.parseInt(strPage); 
if(intPage<1) intPage = 1; 
} 
//得到总的数据记录行数
intRowCount=data.getRowCount(mysql+where); //总记录数

//计算总共要分多少页
intPageCount = (intRowCount+intPageSize-1) / intPageSize; 
//调整待显示的页码 

if(intPage>intPageCount) intPage = intPageCount; 
//分页段
     %>
     <div class="div8"></div>
     <table width="100%" border="0" cellpadding="0" cellspacing="0">
       <tr>
         <td align="center" valign="top">
           <table width="100%" height="627" border="0" cellpadding="0" cellspacing="0">
             <tr >
               <td align="left" valign="top" >
                <table width="100%" border="0">
                  <tr>
                    <td style=" background:url(images/search.gif)" height="38"></td>
                  </tr>
                </table>
                 <table width="93%" border="0" align="center" cellpadding="0" cellspacing="0" style=" font-size:12px; color:#000000; border-bottom:1px solid #333333">
                  <tr>
                   <td  height="38" align="left">你搜索<span style=" color:#006666; padding:6px;"><% if(!("".equals(key) || key==null)){ out.print(key); }else{ out.print("全部");}%></span>的结果如下</td>
                    <td  height="38" align="right">总 <%=intRowCount%> 条记录 当前第<%=intPage%>页</td>
                  </tr>
                </table>
                <table width="99%" border="0" cellpadding="8" align="right">
         <% 
  
         begin_no=(intPage-1) * intPageSize + 1; 
        end_no = intPage * intPageSize;
	    mysql="select * from (select rownum row_id ,iid,title,info,addtime,classid from (select  iid,title,info,addtime,classid from web_info where iid>0 "+where+" order by iid desc))";
	    mysql=mysql+" where row_id between " +begin_no+ " and " +end_no;
	  //out.print(mysql);//out.close();
	    ResultSet rsc=con.getRs(mysql);
		int i=0;
try{
        String otm="";
		while(rsc.next()){
		i++;
		otm=rsc.getString("info");
         %>
	      <tr>
             <td class="infolist"><table width="100%" border="0" cellpadding="0" cellspacing="0">
								  <tr>
									<td><img src="images/serach_area_bj.gif"></td>
							</tr>
								  <tr>
									<td style=" background:url(images/serach_area_line.gif) left repeat-y;" background="images/serach_area_line.gif">
									<div style=" border-bottom:1px  solid #ccc;height:26px;width:96%; margin:0px auto;">
									 <span style="float:left;"><a href="display.jsp?m=<%=menu %>&iid=<%=rsc.getString("iid")%>" style="color:#C62229;" target="_blank"><%=rsc.getString("title") %></a></span><span style="float:right;"><%=rsc.getDate("addtime") %></span>
									 </div>  
									</td>
							</tr>
									<tr>
									<td style=" background:url(images/serach_area_line.gif) left repeat-y;" background="images/serach_area_line.gif">
									<div style="width:96%; margin:0px auto;"> <% if(!("null".equals(otm) || "".equals(otm) || otm==null)){%>
									  <%=otm %>
									  <%  }%></div>
									</td>
									</tr>
								  <tr>
									<td><img src="images/serach_area_botbj.gif"></td>
							</tr>
								</table>

                         
             </td>
           </tr>
           
      <%} %>
           <%if(intPageCount>1){ %>
            <tr>
             <td align="center"> <div class="pagelist"><%
             String pagehtml=con.getPage(intPage,intRowCount,intPageCount,"?sokey="+key);
             out.print(pagehtml);
 %>         </div></td>
           </tr>
           <%} %>
     </table>
<% rsc.close();
}catch(Exception e){ }
%>
               </td>
               </tr>
           </table></td>
         </tr>
     </table>
     <%@ include file="bot2.jsp" %> </td>
<td width="209" valign="top" height="640" >        
        <%@ include file="right2.jsp" %>
     </td>
   </tr>
 </table>
</div>
 <%@ include file="foot.html" %>